$(function(){
	// 查询 集团要问的列表
	var par = {
			cid:101,
			status:1,
			pageNo:1,
			pageSize:6
	};
	geetdata("../../article/pagelist.do", par, "#jtyw1", "jtyw_list", "jituanyaowen", false);
	
	// 查询 综合新闻 102
	var par = {
			cid:102,
			status:1,
			pageNo:1,
			pageSize:3
	};
	geetdata("../../article/pagelist.do", par, "#zhxwDP", "zhxwDP_list", "zonghexinwendp", false);
	
	// 查询 深度报道 103
	var par = {
			cid:103,
			status:1,
			pageNo:1,
			pageSize:3
	};
	// geetdata("../../article/list.do", par, "#bText", "sdbdDP_list", "shengdubaodaodp", false);
	$.getJSON("../../article/list.do", par,function(json){
		view(json, "#bText", "sdbdDP_list");
		(function(){
			var oBScroll=document.getElementById('scroll');
		    var oPre=document.getElementById('clickP');
		    var oNext=document.getElementById('clickN');

		    var oBBox=document.getElementById('bMax');
		    var oBText=document.getElementById('bText');
		    // var maxContTop=oBText.offsetHeight-parseInt(getStyle(oBBox,'height'));
		    var maxContTop=oBText.offsetHeight-oBBox.offsetHeight;
		    var maxSTop=oBScroll.parentNode.offsetHeight-oBScroll.offsetHeight;
		    var top=0;

		    oBScroll.onmousedown=function(ev){
		        var oEvent=ev || event;
		        var disY=oEvent.clientY-oBScroll.offsetTop;

		        document.onmousemove=function(ev){
		            var oEvent=ev || event;
		            top=oEvent.clientY-disY;

		            if(top<0){
		                top=0;
		            }else if(top>maxSTop){
		                top=maxSTop;
		            }
		            oBScroll.style.top=top+'px';
		            var nContTop=top/maxSTop*maxContTop;
		            oBText.style.top=-(nContTop)+'px';
		        };

		        document.onmouseup=function(){
		            document.onmousemove=null;
		            document.onmouseup=null;

		            oBScroll.releaseCapture && oBScroll.releaseCapture();
		        };
		        oBScroll.setCapture && oBScroll.setCapture();
		        return false;
		    };

		    oNext.onmousedown=function(){
		        top+=40;

		        if(top>maxSTop){
		            top=maxSTop;
		        }
		        oBScroll.style.top=top+'px';
		        var nContTop=top/maxSTop*maxContTop;
		        oBText.style.top=-(nContTop)+'px'
		    };

		    oPre.onmousedown=function(){
		        top-=40;

		        if(top<0){
		            top=0;
		        }
		        oBScroll.style.top=top+'px';
		        var nContTop=top/maxSTop*maxContTop;
		        oBText.style.top=-nContTop+'px'
		    };

		    function getStyle(obj, sName){
		        return (obj.currentStyle || getComputedStyle(obj, false))[sName];
		    }
		})();
	});
	//这是一个非常简单的demo实例，让列表元素分页显示
	//回调函数的作用是显示对应分页的列表项内容
	//回调函数在用户每次点击分页链接的时候执行
	//参数page_index{int整型}表示当前的索引页
	
	 var name = 'jituanyaowen';
	 initPagination1(name);
	 function initPagination1(name) {

			var value = $.cookie(name);
			var opation = JSON.parse(value);
			var num_entries = opation.total; // $("#hiddenresult div.result").length;
			console.log("------------"+num_entries)
			console.info(opation)
			console.log("------------")
			// 创建分页
			$("#Pagination1").pagination(num_entries, {
				num_edge_entries: 1, //边缘页数
				num_display_entries: 5, //主体页数
				 callback: pageselectCallback,
				items_per_page:6, //每页显示1项
				prev_text:'上一页',
				next_text:'下一页',
				num_edge_entries:true
			});
		 };
		 
	function pageselectCallback(page_index, jq) {
		console.info(jq);
		toPage(page_index+1,'jituanyaowen', '../../article/pagelist.do', '#jtyw', 'jtyw_list', false);
	}
	
	
	
	
	
	
	
})
